#ifndef CONFIG_H
#define CONFIG_H

#pragma once

#include <Json.hpp>
#include <string>

struct Config
{
    int listenport;
    struct mysql
    {
        std::string hostname;
        int port;
        std::string username;
        std::string password;
        std::string database;
    } mysql;

    struct httpserver
    {
        std::string doc_root;
        std::string domain;
        int port;
    } httpserver;

    bool loadConfig(std::string path);
};

void tag_invoke(boost::json::value_from_tag, boost::json::value& jv, struct Config const& c);

struct Config tag_invoke(boost::json::value_to_tag<struct Config>, boost::json::value const& jv);
#endif